<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <div id="name"><p>{{count}}</p>
    <button v-on:click="add(1,$event)">+1</button>
    </div>
<script src="lib/vue-2.6.12.js"></script>
<script>
    const vm=new Vue({
        el:'#name',
        data:{
            username:'sb',
            count:1
        },
        methods:{
            add(n,e){
                console.log(123)
                vm.count+=n
                if (vm.count%2===0){
                    e.target.style.backgroundColor='green'
                }
                else {
                    e.target.style.backgroundColor='red'
                }
            }
        }
    })
</script>
</body>
</html>